ARG BASE_VERSION
FROM zwl/jodconverter-runtime:$BASE_VERSION

ENV JAR_FILE_BASEDIR=/opt/app
ENV LOG_BASE_DIR=/var/log
ENV NONPRIVUSER=jodconverter
ENV NONPRIVGROUP=jodconverter

RUN mkdir -p ${JAR_FILE_BASEDIR} /etc/app \
  && touch /etc/app/application.properties /var/log/app.log /var/log/app.err \
  && chown $NONPRIVUSER:$NONPRIVGROUP /var/log/app.log /var/log/app.err


ARG JAR_FILE=jod-convert-rest.jar
COPY ${JAR_FILE} ${JAR_FILE_BASEDIR}/app.jar

# ENTRYPOINT ["/docker-entrypoint.sh"]
# CMD ["--spring.config.additional-location=optional:/etc/app/"]

ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms1024m -Xmx2048m -Djava.security.egd=file:/dev/./urandom"

CMD exec gosu jodconverter java  $JAVA_OPTS -jar $JAR_FILE_BASEDIR/app.jar
